import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 * Created by berkbozkurt on 07/03/15.
 */
public class SoftBrick extends Rectangle implements Brick  {


    private Dimension size;
    private int life;
    private Point location;

    public SoftBrick() {
        super();
        life = 1;
        width = 100;
        height = 40;
        location = new Point();

    }

    @Override
    public void setLocation(int x, int y) {
        location.x = x;
        location.y = y;

    }

    @Override
    public Point getLocation() {
        return location;
    }

    @Override
    public BufferedImage getImage() {
        BufferedImage img = null;
        try {
            img = ImageIO.read(new File("resources/softBrick.png"));
        }
        catch (IOException e) {
            e.printStackTrace();
        }
        return img;
    }
    @Override
    public Dimension getSize() {return size; }

    @Override
    public void setSize(Dimension size) {
        this.size = size;
    }
    @Override
    public void update() {
        setFrame(location.x, location.y, size.getWidth(), size.getHeight());
    }

    @Override
    public void decreaseLife() {
        life--;
    }
    @Override
    public int getLife() {
        return life;
    }

    @Override
    public void destroyBrick() {
        life = 0;
    }
}
